package com.boang.string;

/*
    @author:sa
    @date:2024/11/21 11:03
*/
public class StringDemo {
    public static void main(String[] args) {
//        m2();
//        m1();
//        m3();
//        m4();
        String s1=new String("A");
        String s2="A";
        System.out.println(s1==s2);
    }

    private static void m4() {
        String s1="A";
        s1="B";
    }

    private static void m3(){
        String s1 ="A";
        String s2 = "A";
        System.out.println(s1 == s2);
    }

    private static void m2() {
        String s1 = "A";
        String s2 = "B";
        System.out.println(s1 == s2);
    }

    private static void m1() {
        String s1 = new String();
        String s2 = "";
        System.out.println(s1 == s2);
        System.out.println(s1.equals(s2));
    }
}